<?php
if ($_POST) {
    include 'common/check.php';
    include 'rfq_do.php';
    include '../business/rfq_product_manager.php';
    include_once '../entity/rfq_product_entity.php';

    $rfqProductMng = new RFQProductMng();
    $rfqProductEntity = new RFQProductEntity();

    $rfqProductEntity->id                   = "-1";
    $rfqProductEntity->rfqID                = $rfqID;
    $rfqProductEntity->product              = $_POST['sl_product'];
    $rfqProductEntity->isInclude            = $_POST['rd_isInclude'] == "1" ? true : false;
    $rfqProductEntity->description          = $_POST['txt_description'];
    $rfqProductEntity->plasticType          = $_POST['sl_plasticType'];
    $rfqProductEntity->color                = $_POST['sl_color'];
    $rfqProductEntity->weatherStability     = $_POST['sl_weatherStability'];
    $rfqProductEntity->effect               = $_POST['sl_effect'];
    $rfqProductEntity->lightFastness        = $_POST['sl_lightFastness'];
    $rfqProductEntity->shade                = $_POST['sl_shade'];
    $rfqProductEntity->rating               = $_POST['sl_rating'];
    $rfqProductEntity->additionalFunction   = $_POST['sl_additionalFunction'];
    $rfqProductEntity->inTime               = time();
    $rfqProductEntity->inUser               = $_SESSION['userID'];

    if ($rfqProductMng->update($rfqProductEntity)) {
        echo "<script>window.location.href='rfq_submit.php'</script>";
    }
    
} else {
    include 'common/smarty.php';

    $tpl->display('rfq_product.html');
}

?>
